package books.ThinkingInJava.src.Chapter14;

import books.ThinkingInJava.src.Tools.Output;

import java.util.Scanner;

public class ShowMethods {
    public static void main(String[] args) {
        try {
            Scanner scan = new Scanner(System.in);
            if (scan.hasNext()) {
                String ss = scan.nextLine();
                Class cs = Class.forName(ss);
                out("Methods:", cs.getMethods());
                out("Constructors:", cs.getConstructors());
                out("Interfaces:", cs.getInterfaces());

            }
        } catch (Exception ioe) {
            ioe.printStackTrace();
        }
    }

    private static void out(String s, Object[] objs) {
        if (s != null) {
            Output.println(s);
        }
//        Constructor c = (Constructor) objs[0];  //强制类型转换
        if (objs != null && objs.length > 0) {
            for (Object obj : objs) {
                Output.println(obj.toString());
            }
        }
    }
}
